POV-Ray : Newsgroups : povray.general : unexpected rotation result : Re: unexpected rotation result Server Time
8 Aug 2024 14:21:04 EDT (-0400)
  Re: unexpected rotation result  
From: David Fontaine
Date: 5 Feb 2001 18:13:59
Message: <3A7F3390.822EA9BB@faricy.net>
"Peter J. Holzer" wrote:

> That one should be the same (3) in just about every programming
> language. But there are more difficult examples. E.g., what is
> (0x11 & 0xF0 == 0x10) in C? C has so many operators that even the
> experienced C programmer gets confused sometimes. It gets worse if you
> use several programming languages with slightly different evaluation
> rules.

True, parentheses can help you be less obfuscated. But I thought all
languages had the same order of operations, except maybe a few very obscure
examples.


> However, more parentheses are not always more readable. Where the
> average programmer already knows the precedence (e.g, multiplication
> before addition), they only clutter the display and make the reader
> wonder why they were used. For example, I wouldn't write
>     1+(2*3)+4,
> although I would probably write
>     1 + 2*3 + 4
> to enhance readability for the human reader.

I find myself doing that more; put a space padding around additive
operations but bunch together multiplicative operations. That shows the
algebraic seperation of terms, which incidentally is also where the parser
should seperate it. So is useful to know. :)


--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.